#include <iostream>
#include <vector>
#include <stack>
using namespace std;
int main()
{
    int T=0;
    cin >>T;
    while(T--)
    {
        int n,k;
        cin >>n >>k;
        vector<int> poke(2*n,0);
        for(auto& e:poke)
        {
            cin>>e;
        }
        for(int i=0;i<k;i++)
        {
            vector<int> tmp=poke;
            for(int j=0;j<n;j++)
            {
                poke[2*j]=tmp[j];
                poke[2*j+1]=tmp[n+j];
            }
        }
        for(auto& e:poke)
        {
            cout <<e<<" ";
        }
        cout <<endl;

    }
    
    return 0;
}